import axios from 'axios'

export function ajaxGet(url, option, callback) {
    axios({
        method: 'get',
        url: url,
        data: option
    }).then((response) => {
        if (response.status === 200) {
            return callback(response.data);
        }
    }).catch((error) => {
        console.log(error)
    });
}

export function ajaxPost(url, option, callback) {
    axios({
        method: 'post',
        url: url,
        data: option,
        headers:{
            'Content-Type':'application/json'
        }
    }).then((response) => {
        if (response.status === 200) {
            return callback(response.data);
        }
    }).catch((error) => {
        console.log(error)
    });
}
